package Server.dao;

import Server.entity.Shop;
import Server.entity.ShopSpec;
import io.lettuce.core.dynamic.annotation.Param;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface ShopSpecDao extends JpaRepository<ShopSpec,String> {
    List<ShopSpec> findByShopAndStatus(Shop shop,ShopSpec.Status status);
    ShopSpec findByUuid(String uuid);
    @Modifying
    @Query(value = "update shop_spec set status='NO' where shop_id = ?2 and uuid not in (?1)",nativeQuery = true)
    Integer updateById(String uid,String shopId);

    List<ShopSpec> findByStatusAndRepertoryBetween(ShopSpec.Status status,Integer begin,Integer end);
}
